package de.gridsolut.springboot.test.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Component;







import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

//http://www.vogella.com/tutorials/REST/article.html
@Component
@Path("/hello")
public class Hello {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayPlainTextHello() {
        return "Hello Jersey";
    }


    @GET
    @Path("/book/{name}")
    @Produces("application/json")
    public List getList(@PathParam("name") String name) {
    	List ru=new ArrayList();
    	ru.add("chyy");
    	ru.add("chyy2");
    	ru.add("chyy3");
    	ru.add(name);
        return ru;
    }
    
    @GET
    @Produces(MediaType.TEXT_XML)
    public String sayXMLHello() {
        return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    public String sayHtmlHello() {
        return "<html> " + "<title>" + "Hello Jersey" + "</title>"
                + "<body><h1>" + "Hello Jersey" + "</body></h1>" + "</html> ";
    }

}
